3.318 \(\int \frac{\cos ^2(x)}{(a+b \sin ^2(x))^2} \, dx\)

Optimal. Leaf size=54 \[ \frac{\tan ^{-1}\left (\frac{\sqrt{a+b} \tan (x)}{\sqrt{a}}\right )}{2 a^{3/2} \sqrt{a+b}}+\frac{\tan (x)}{2 a \left ((a+b) \tan ^2(x)+a\right )} \]

[Out]

ArcTan[(Sqrt[a + b]*Tan[x])/Sqrt[a]]/(2*a^(3/2)*Sqrt[a + b]) + Tan[x]/(2*a*(a + (a + b)*Tan[x]^2))

________________________________________________________________________________________

Rubi [A]  time = 0.0559371, antiderivative size = 54, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {3191, 199, 205} \[ \frac{\tan ^{-1}\left (\frac{\sqrt{a+b} \tan (x)}{\sqrt{a}}\right )}{2 a^{3/2} \sqrt{a+b}}+\frac{\tan (x)}{2 a \left ((a+b) \tan ^2(x)+a\right )} \]

Antiderivative was successfully verified.

[In]

Int[Cos[x]^2/(a + b*Sin[x]^2)^2,x]

[Out]

ArcTan[(Sqrt[a + b]*Tan[x])/Sqrt[a]]/(2*a^(3/2)*Sqrt[a + b]) + Tan[x]/(2*a*(a + (a + b)*Tan[x]^2))

Rule 3191

Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeF
actors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p + 1), x], x, T
an[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]

Rule 199

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> -Simp[(x*(a + b*x^n)^(p + 1))/(a*n*(p + 1)), x] + Dist[(n*(p +
 1) + 1)/(a*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x] /; FreeQ[{a, b}, x] && IGtQ[n, 0] && LtQ[p, -1] && (In
tegerQ[2*p] || (n == 2 && IntegerQ[4*p]) || (n == 2 && IntegerQ[3*p]) || Denominator[p + 1/n] < Denominator[p]
)

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\cos ^2(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx &=\operatorname{Subst}\left (\int \frac{1}{\left (a+(a+b) x^2\right )^2} \, dx,x,\tan (x)\right )\\ &=\frac{\tan (x)}{2 a \left (a+(a+b) \tan ^2(x)\right )}+\frac{\operatorname{Subst}\left (\int \frac{1}{a+(a+b) x^2} \, dx,x,\tan (x)\right )}{2 a}\\ &=\frac{\tan ^{-1}\left (\frac{\sqrt{a+b} \tan (x)}{\sqrt{a}}\right )}{2 a^{3/2} \sqrt{a+b}}+\frac{\tan (x)}{2 a \left (a+(a+b) \tan ^2(x)\right )}\\ \end{align*}

Mathematica [A]  time = 0.143341, size = 59, normalized size = 1.09 \[ \frac{\tan ^{-1}\left (\frac{\sqrt{a+b} \tan (x)}{\sqrt{a}}\right )}{2 a^{3/2} \sqrt{a+b}}-\frac{\sin (2 x)}{2 a (-2 a+b \cos (2 x)-b)} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]^2/(a + b*Sin[x]^2)^2,x]

[Out]

ArcTan[(Sqrt[a + b]*Tan[x])/Sqrt[a]]/(2*a^(3/2)*Sqrt[a + b]) - Sin[2*x]/(2*a*(-2*a - b + b*Cos[2*x]))

________________________________________________________________________________________

Maple [A]  time = 0.077, size = 51, normalized size = 0.9 \begin{align*}{\frac{\tan \left ( x \right ) }{2\,a \left ( \left ( \tan \left ( x \right ) \right ) ^{2}a+ \left ( \tan \left ( x \right ) \right ) ^{2}b+a \right ) }}+{\frac{1}{2\,a}\arctan \left ({ \left ( a+b \right ) \tan \left ( x \right ){\frac{1}{\sqrt{a \left ( a+b \right ) }}}} \right ){\frac{1}{\sqrt{a \left ( a+b \right ) }}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^2/(a+b*sin(x)^2)^2,x)

[Out]

1/2/a*tan(x)/(tan(x)^2*a+tan(x)^2*b+a)+1/2/a/(a*(a+b))^(1/2)*arctan((a+b)*tan(x)/(a*(a+b))^(1/2))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(a+b*sin(x)^2)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.19838, size = 749, normalized size = 13.87 \begin{align*} \left [\frac{4 \,{\left (a^{2} + a b\right )} \cos \left (x\right ) \sin \left (x\right ) +{\left (b \cos \left (x\right )^{2} - a - b\right )} \sqrt{-a^{2} - a b} \log \left (\frac{{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \,{\left (4 \, a^{2} + 5 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 4 \,{\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{3} -{\left (a + b\right )} \cos \left (x\right )\right )} \sqrt{-a^{2} - a b} \sin \left (x\right ) + a^{2} + 2 \, a b + b^{2}}{b^{2} \cos \left (x\right )^{4} - 2 \,{\left (a b + b^{2}\right )} \cos \left (x\right )^{2} + a^{2} + 2 \, a b + b^{2}}\right )}{8 \,{\left (a^{4} + 2 \, a^{3} b + a^{2} b^{2} -{\left (a^{3} b + a^{2} b^{2}\right )} \cos \left (x\right )^{2}\right )}}, \frac{2 \,{\left (a^{2} + a b\right )} \cos \left (x\right ) \sin \left (x\right ) +{\left (b \cos \left (x\right )^{2} - a - b\right )} \sqrt{a^{2} + a b} \arctan \left (\frac{{\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a - b}{2 \, \sqrt{a^{2} + a b} \cos \left (x\right ) \sin \left (x\right )}\right )}{4 \,{\left (a^{4} + 2 \, a^{3} b + a^{2} b^{2} -{\left (a^{3} b + a^{2} b^{2}\right )} \cos \left (x\right )^{2}\right )}}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(a+b*sin(x)^2)^2,x, algorithm="fricas")

[Out]

[1/8*(4*(a^2 + a*b)*cos(x)*sin(x) + (b*cos(x)^2 - a - b)*sqrt(-a^2 - a*b)*log(((8*a^2 + 8*a*b + b^2)*cos(x)^4
- 2*(4*a^2 + 5*a*b + b^2)*cos(x)^2 + 4*((2*a + b)*cos(x)^3 - (a + b)*cos(x))*sqrt(-a^2 - a*b)*sin(x) + a^2 + 2
*a*b + b^2)/(b^2*cos(x)^4 - 2*(a*b + b^2)*cos(x)^2 + a^2 + 2*a*b + b^2)))/(a^4 + 2*a^3*b + a^2*b^2 - (a^3*b +
a^2*b^2)*cos(x)^2), 1/4*(2*(a^2 + a*b)*cos(x)*sin(x) + (b*cos(x)^2 - a - b)*sqrt(a^2 + a*b)*arctan(1/2*((2*a +
 b)*cos(x)^2 - a - b)/(sqrt(a^2 + a*b)*cos(x)*sin(x))))/(a^4 + 2*a^3*b + a^2*b^2 - (a^3*b + a^2*b^2)*cos(x)^2)
]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)**2/(a+b*sin(x)**2)**2,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.11575, size = 104, normalized size = 1.93 \begin{align*} \frac{\pi \left \lfloor \frac{x}{\pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (2 \, a + 2 \, b\right ) + \arctan \left (\frac{a \tan \left (x\right ) + b \tan \left (x\right )}{\sqrt{a^{2} + a b}}\right )}{2 \, \sqrt{a^{2} + a b} a} + \frac{\tan \left (x\right )}{2 \,{\left (a \tan \left (x\right )^{2} + b \tan \left (x\right )^{2} + a\right )} a} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(a+b*sin(x)^2)^2,x, algorithm="giac")

[Out]

1/2*(pi*floor(x/pi + 1/2)*sgn(2*a + 2*b) + arctan((a*tan(x) + b*tan(x))/sqrt(a^2 + a*b)))/(sqrt(a^2 + a*b)*a)
+ 1/2*tan(x)/((a*tan(x)^2 + b*tan(x)^2 + a)*a)